using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       GSRole_EnterSender.cs
*@brief      send message GSRole_Enter
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/3/19
*/

//send message GSRole_Enter
public class msgGSRole_Enter
{
    public const int MessageId = (int)GameServerTypes.MessageType.GSRole_Enter;
    //TODO
	public int SessionId = NetLib.INVALID_SESSION;
	public gameserver.RoleEnter MsgContent = new gameserver.RoleEnter();
	/// <summary>
	/// Initializes a new instance of the <see cref="msgGSRole_Enter"/> class.
	/// </summary>
	/// <param name='session_id'>
	/// Session_id.
	/// </param>
	/// <param name='usr_info'>
	/// Usr_info.
	/// </param>
	public msgGSRole_Enter(int session_id, UsrInfoCacheUnit usr_info)
	{
		SessionId = session_id;
		MsgContent.GateCode = usr_info.GateCode;
		MsgContent.RoleCode = usr_info.RoleCode;
		MsgContent.UsrId = usr_info.UsrId;
		MsgContent.UsrName = usr_info.UsrName;
		MsgContent.WorldId = usr_info.WorldId;
	}
}

//handle message
public partial class gwMessagePort
{
    /// <summary>
    /// handle message
    /// </summary>
    /// <param name="msg">message wrapper of GSRole_Enter</param>
    public static void ProcessMessage(msgGSRole_Enter msg)
    {
        //TODO
        //Main Message:  msgGameServer
		msgGameServer mainMsg = new msgGameServer(msg.SessionId, msgGSRole_Enter.MessageId, ProtoNet<gameserver.RoleEnter>.IntoBytes(msg.MsgContent));
		gwMessagePort.ProcessMessage(mainMsg);
    }
}
